package com.tang.rabbitmq;

 import com.tang.websocket.WebSocketServer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.amqp.rabbit.annotation.RabbitListener;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.stereotype.Component;


@Configuration
 public class VoteTopicConsumer {

     private static final Logger LOG = LoggerFactory.getLogger(VoteTopicConsumer.class);

     @Autowired
     public WebSocketServer webSocketServer;


     @RabbitListener(queues = "vote")
     public void onMessage(String message) {
         LOG.info("ROCKETMQ收到消息：{}", message);
         webSocketServer.sendInfo(message);
     }
 }
